home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
113
/
gfatip11
/
gfatip11.doc
< prev
Wrap
Text File
|
1987-11-01
|
9KB
|
191 lines
November 1, 1987
GFATIP11.DOC
by John B. Holder
Senior Software Engineer
Marathon Computer Press
Asst. Sysop on GEnie's MichTron Roundtable
This is the 11th in a planned series of GFA Tip files. The
topic of this issue is using Desk.Acc's from within a running GFA
Basic program without punching a hole in the screen when the
accessory exits. In this archive you will find the following
files:
Accfix.Bas
Accfix.Prg
GFATIP11.Doc
The enclosed files will be pretty much self explanatory, so I
will keep this Doc file to a short explanation and take a few
lines to make a warning or two.
The Problem?
The problem with the current version of GFA Basic is that
when a Desk Accessory is selected and then exited, a nice gaping
hole is left in the middle of the screen where it once lived.
This is due to a number of reasons. The main one being that the
Developer chose to present a white background screen most likely
cleared with a VT52 Clear Screen command. Aside from the obvious,
it has become painfully obvious to GFA Basic Programmers and
Developers. The worst part is that it is almost impossible to
detect when an accessory is either opened, or closed with GFA
Basic unless you resort to numerous GEM calls that are very
confusing and unforgiving. If you happen to be one of those that
prefer the hard way, more power to you. A good reference would be
The GFA Basic Book (By MichTron) if you choose the GEM route. For
the rest of the world, myself included; I have created this tip
file to solve the problem.
The Solution?
Our chosen solution is foolproof only if the program user is
willing to cooperate a bit, and if you keep a few things in mind
when developing your programs. I'll leave the nitty gritty
details to the commented GFA Basic source code, and only mention
the cooperation details and the warnings.
Cooperation:
This fix requires the User to tell the program when they
want to use an accessory, & then tell the program when he or she's
done with it. To enforce this option, we disable the desk
accessories right off the bat, (see the source for details). Next
we offer a Menu Option "Accessory". Under this option there are
two choices, "Use an Accessory" & "Return". When "Use an
Accessory" is selected a series of reactions take place. They
are:
Part 1
1. See first if the option is already selected. If it is,
let's just ignore the request.
2. Check to see if we have 32000 bytes of spare memory for
the screen buffer.
3. If so set the ACCSHOW variable (means we're gonna' do it).
4. Grab the currently displayed screen.
5. Put up a GEM Desktop compatible chalkboard, (background
color and fill pattern for the current resolution) for the
Accessory to work on.
6. Enable all of the present Accessories that are being
reported to the GEM menu.
7. Disable all of the other options in the GEM Menu until we
are done with the Accessory.
Part 2
If the "Return" option is selected we start a series of
reactions that go something like this:
1. Is the ACCSHOW variable set? If so then this is a valid
call, if not just ignore it.
2. Next we put the screen buffer back into place, just as it
was when we decided to use an Accessory.
3. Clear the ACCSHOW variable.
4. Clear the Screen Buffer and return the 32000 bytes to the
dynamic memory pool so it can be used by the application.
5. Force the application to do some garbage collection. Only
takes a microsecond (give or take a few picoseconds) <grin> &
helps out with memory management and can speed up the running of
the application.
6. Re-enable all of the regular menu options and disable the
Desk.Acc options.
7. Get back to your application and allow GEM to handle the
user interface.
** Warnings **
The user must be told in documentation that if they select
the "Use an Accessory" option that they MUST properly close the
Accessory before choosing the "Return" option. Failure to do so
will cause the accessory to be hidden behind the Screen Buffer
replacement screen when "Return" is chosen. This is bad for a
number of reasons. It can cause the Desk.Acc to interact with
your program when returning.... Ie.. mouse click on a hidden
dialog box, or worse. Not good! Hey, then again; How many
people use an accessory and then don't close it? Believe me, they
will try if you don't tell them first that this is a no no. We
don't want hate mail from a disgruntled User do we? So the moral
of the story is tell them that you want them to be able to use
accessories, but they need to cooperate and tell you when they're
done. Sounds Fair, Right? In return, there won't be any
unsightly holes punched in the screen when a Desk.Acc is used.
The second warning is to those that are using applications
that may have a GEM window on the screen when "Use an Accessory"
is selected. If this is the case, you should do a few things in
order to make the option work properly. They are:
1. Either close your window first <or>
2. Fullw(#) and then Clearw(#) before allowing the "Use an
Accessory" option to draw the chalkboard.
Why?
By the nature of GEM, all graphics commands are automatically
directed to the currently active window. Therefore, if a window is
open the chalkboard will go into IT and not the entire screen as
is intended. So... Big deal? Well, if your active GEM window is
not "Fulled" we won't get the full protection of the temporary
chalkboard since the Desk.Acc may appear anywhere on the screen or
perhaps be moved anywhere on the screen. Take my word for it,
I've tried and failed any other way. In a nutshell, if you allow
the access to the GEM menu bar while a window is displayed, it's
best to first close the window(s) and then let "Use an Accessory"
do it's work. Following the "Return" you can always reconstruct
the screen. To detect that you can place a Flag variable at the
end of the "Return" menu option handler to signal that a Redraw is
necessary.
Closing Comments
Although not entirely foolproof, this method of utilizing
Desk Accessories is the most complete and clean way I've seen so
far. It's sure better than some Kludge to detect if a point on
the screen has been altered and then try to do a redraw! If used
properly, it should suffice in the pursuit of allowing Users to
use their Accessories, while maintaining screen integrity.
Hopefully a spirit of cooperation will prevail and everyone will
be happy.
The Way Ahead?
The developer of GFA Basic has stated that he'll attempt to
come up with a fix for the current Desk.Acc malady with the next
version (3.0) due in the late spring of 1988. There were no
promises made though, so don't quote that statement and try not to
be disappointed if it doesn't happen.
Comments and PD release
This GFATIP file is in the public Domain. However, the
documentation file is Copyright (c)1987 by Marathon Computer
Press, and is provided as a public service. You may not include
the text of this file in any publication, or newsletter without
the approval of Marathon Computer Press. The source code and idea
are free for grabs. You may also post this file on any bulletin
board as long as it is posted in it's entirety. No charge (of any
kind) may be assessed for providing this Tip to the public. If
it's not 100% Free, don't do it! Nuff Said.
I hate to have to do this, but some people have been selling
my GFATIP series at a profit. If anyone has a right to do that,
it's Marathon Computer Press & nobody else. I hope you
understand. If you have comments concerning this file, or any
other GFATIP file you may leave electronic mail for me on:
GEnie => GRIFJOHN
CIS => 75766,505
Or Write to:
Marathon Computer Press
P.O. Box 68503
Virginia Beach, Virginia 23455